﻿
if(!document.URL.match(/screen=place/)){UI.InfoMessage("السكربت يعمل من نقطة التجمع ، جاري التحويل ..",3000,true);var ID = window.document.URL.match(/\d+/g)[1];window.open("/game.php?village="+ID+"&screen=place","_self");}else{

$("#content_value").prepend("<center><table class='vis' style='border: 1px solid #7D510F;margin: 15px 5px;box-shadow: 1px 1px 2px 1px rgba(60, 30, 0, 0.2);'><tbody><tr><th colspan='3'><center>المبرمج</center></th></tr><tr><td><center><b>Wisdom</b></center></td></tr><tr><th colspan='3'>عدد التابات :</th></tr><tr><td><input id='wis' type='text' size='32' minlength='1' value='4' name='name'></input></td></tr><tr><th colspan='3'>الاحداثيات :</th></tr><tr><td><input id='dom' type='text' size='32' minlength='1' value='123|456' name='name'></input></td></tr><td><center><input id='rere' class='btn' type='submit' value='موافق'><input id='CJ' class='btn' type='submit' value='مستخرج الاحداثيات'></input></center></td></tbody></table></center></br>");

$(function(){$("#rere").click(function(){
    var N =$("#wis").val();
    var Coords = $("#dom").val();
    var spear = $("#unit_input_spear").val();
    var sword = $("#unit_input_sword").val();
    var axe = $("#unit_input_axe").val();
    var archer = $("#unit_input_archer").val();
    var spy = $("#unit_input_spy").val();
    var light = $("#unit_input_light").val();
    var marcher = $("#unit_input_marcher").val();
    var heavy = $("#unit_input_heavy").val();
    var ram = $("#unit_input_ram").val();
    var catapult = $("#unit_input_catapult").val();
    var knight = $("#unit_input_knight").val();
    var snob = $("#unit_input_snob").val();
    var place = {};for(i=0; i<N; i++){place[""+i+""] = window.open('/game.php?village='+game_data.village.id+'&screen=place','place_'+i);}for(t=0; t<N; t++){place[""+t+""].onload = (function(v){return function(){window.open('javascript:coords = "Coords" ;coords = coords.split(' ');index = Math.round(Math.random()*(coords.length-1));coords = coords[index];$(".ui-autocomplete-input").val(Coords);$("#unit_input_spear").val(spear);$("#unit_input_sword").val(sword);$("#unit_input_axe").val(axe);$("#unit_input_archer").val(archer);$("#unit_input_spy").val(spy);$("#unit_input_light").val(light);$("#unit_input_marcher").val(marcher);$("#unit_input_heavy").val(heavy);$("#unit_input_ram").val(ram);$("#unit_input_catapult").val(catapult);$("#unit_input_knight").val(knight);$("#unit_input_snob").val(snob);void(0)','place_'+v);}})(t);}});});
	$(function(){$("#CJ").click(function(){
    var debugEnabled = true;
    var branch = 'http://dl.dropbox.com/u/25377948/twscripts/';
    $.getScript("https://dl.dropboxusercontent.com/s/er0b6cxmym8pqd5/Find%20Farms.js"
                ,function(){
                    $.twFarmFinder(branch,debugEnabled);
                });
});
            });
}